class ProcessManagerException(Exception):
    """进程管理器基础异常"""
    def __init__(self, message: str, code: int = 400):
        self.message = message
        self.code = code
        super().__init__(self.message)

class ProcessNotExistException(ProcessManagerException):
    """进程不存在异常"""
    def __init__(self, process_name: str):
        super().__init__(f"进程 {process_name} 不存在", 404)

class ProcessStateException(ProcessManagerException):
    """进程状态异常"""
    def __init__(self, process_name: str, current_state: str, operation: str):
        super().__init__(f"进程 {process_name} 当前状态为 {current_state}，无法执行 {operation} 操作", 400)

class ResourceConflictException(ProcessManagerException):
    """资源冲突异常"""
    def __init__(self, process_name: str, conflicting_processes: list, resource_info: str):
        super().__init__(f"进程 {process_name} 无法启动，资源冲突: {resource_info}，冲突进程: {', '.join(conflicting_processes)}", 409)

class ProcessOperationException(ProcessManagerException):
    """进程操作异常"""
    def __init__(self, process_name: str, operation: str, reason: str):
        super().__init__(f"进程 {process_name} {operation} 失败: {reason}", 500)

class ValidationException(ProcessManagerException):
    """参数验证异常"""
    def __init__(self, message: str):
        super().__init__(f"参数验证失败: {message}", 400)

class ConfigurationException(ProcessManagerException):
    """配置异常"""
    def __init__(self, message: str):
        super().__init__(f"配置错误: {message}", 500)